type TradeDict$1 = {
  tradeDictName: string;
  tradeDictCode: string;
  tradeDictPosition?: Array<any>;
};

export type tradeGroupResult = {
  entTypeCode?: string;
  name: string;
  tradeDict: Array<TradeDict$1>;
  tradeDictString?: string;
};
function getTradeGroupString(showTrade?: tradeGroupResult[] | string) {
  if (showTrade) {
    const tradeGroup = !Array.isArray(showTrade) ? JSON.parse(showTrade) : '';
    Array.isArray(tradeGroup) &&
      tradeGroup.map((e) => {
        const trade: string[] = [];
        e.tradeDict.map((t) => {
          trade.push(t.tradeDictName);
        });
        e.tradeDictString = trade.join(',');
      });
    return tradeGroup ? tradeGroup : [];
  } else {
    return [];
  }
}

export { getTradeGroupString };
